<script>
	export default {
    data() {
      return {
        client: 'hzqAppclient',
        secret: 'hzqAppsecret',
        refreshToken: uni.getStorageSync('r_token'),
      }
    },
		onLaunch: function() {
		  console.log('App Launch')
		  // 根据RefreshToken获取新token
		  if (uni.getStorageSync('token')) {
		    this.$http.post('/auth/oauth/token', {
		      refresh_token: this.refreshToken,
		      client_id: this.client,
		      client_secret: this.secret,
		      grant_type: 'refresh_token',
		      auth_type: 'BAccountPassword',
		    }).then(res => {
		      if (res.code == '00000') {
		        // console.log('refresh_token', res)
		        uni.setStorageSync('token', res.data.accessToken)
		      }
		    })
		  }
      },
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
  page{
     /* background: #FFFFFF; */
  }
</style>
